
use _IntuitiveExample.dta, clear

label define case 5 "A" 4 "B" 3 "C" 2 "D" 1 "E" 0 "F", replace
label values Case case

twoway dropline time Case if mediation==1, horizontal lp(dash) lc(gs8) mcol(gs8) ms(Oh) ytitle(Cases) || dropline time Case if mediation==0, horizontal ylab(5/0, valuelabel angle(horizontal)) ms(X) mcol(black) lc(black) legend(order(2 1) region(lwidth(none)) col(1) label(1 "Conflict outbreak with manipulative mediation") label(2 "Conflict outbreak without manipulative mediation")) xline(2.35, lp(dot) lc(gs5)) xtitle(Time) t1title("A: Counterfactual failure times with and without manipulation") || pcarrowi 3.2 3 3.5 2.36 (3) "Mediator influence vanishes", mc(gs5) lc(gs5) lp(shortdash) mlabc(gs5) saving(A, replace)

stset time, failure(failure)
gen id=_n
stset time, failure(failure) id(id)
stsplit, at(failures)

gen pre_post=(_t>2.35)
label define pre_post 1 "After mediator influence vanishes" 0 "During period with mediator influence", replace
label values pre_post pre_post

label define mediation 1 "Manipulation" 0 "No manipulation"
label values mediation mediation

gen failed=1 if _d==1 & time<4.5 
replace failed=0 if time>1 & time<2 & _d==0
replace failed=0 if time==5

graph bar (mean) failed , over(mediation) by(pre_post, t1title("B: Probability of new conflict among surviving cases"))  caption("") ytitle(Percent with new conflict outbreak) bar(1, fcolor(gs10) lcolor(gs10)) saving(B, replace)

sts graph, by(mediation) legend(order(1 2) col(1) region(lwidth(none)) label(2 "with manipulative mediation") label(1 "without manipulative mediation")) xline(2.35, lp(dot) lc(gs5) )  plot1opts(lp(solid) lc(black)) plot2opts(lp(dash) lc(gs8)) xtitle(Time) ytitle(Proportion of cases without new conflict) t1title("C: Survival of peace with and without manipulation") title("") addplot(pcarrowi .88 3 .93 2.36 (3) "Mediator influence vanishes", mc(gs5) lc(gs5) lp(shortdash) mlabc(gs5) legend(order(1 2))) saving(C, replace)

graph combine A.gph B.gph C.gph, col(1) altshrink
graph display, ysize(8)
